package com.bnu.employment.Controller;

import com.bnu.employment.Service.EmploymentService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @author ：Zzy1211
 * @date ：Created in 2019/11/6 21:19
 * @description：
 * @modified By：LARZ
 * @version: 2020.02
 */
@RestController
@RequestMapping(value = "/employment")
public class EmploymentController {
	@Resource
	private EmploymentService employmentService;
	
	/**
     * 功能：查询短期实习/长期招聘的所有数据
     * 接口格式：http://localhost:8080/employment/findAllByEtype?pageNo=1&pageSize=12&e_type=
     * 例子：http://localhost:8080/employment/findAllByEtype?pageNo=1&pageSize=12&e_type=1
     */
    @ResponseBody
    @PostMapping(value = "/findAllByEtype")
    public Object findAllByEtype(HttpServletRequest request){
        return employmentService.findAllByEtype(request);
    }
    
    /**
     * 功能：高级搜索
     * 接口格式：http://localhost:8080/employment/findEmployment?pageNo=1&pageSize=12&e_type=&pa=&major_type=&office_location=
     * 例子：http://localhost:8080/employment/findEmployment?pageNo=1&pageSize=12&e_type=0&pa=百&major_type=&office_location=
     */
    @ResponseBody
    @GetMapping(value = "/findEmployment")
    public Object findEmploymentByWrapper(HttpServletRequest request){
       return employmentService.findEmploymentByWrapper(request);
    }

    /**
     * 功能：按照eId删除数据
     * 接口格式：http://localhost:8080/employment/deleteEmploymentByEid?&eId=
     * 例子：http://localhost:8080/employment/deleteEmploymentByEid?&eId=1
     */
   
    @RequestMapping(value="/deleteEmploymentByEid",method=RequestMethod.POST)
    @ResponseBody
    public Object deleteEmploymentByEid(HttpServletRequest request){
        return employmentService.deleteEmploymentByEid(request);
    }
    
    /**
     * 功能：按照eId插入数据
     * 接口格式：http://localhost:8080/employment/insertEmploymentByEid?&eId=&company=&location=&office_location=&position=&salary=&requirements=&duties=&benefits=&resume_name=&contact=&tag=&e_type=&major_type=
     * 例子：http://localhost:8080/employment/insertEmploymentByEid?eId=1&company=华为&location=北京&office_location=北京市海淀区&position=数据分析师&salary=每天150元左右&requirements=掌握多种数据分析技术&duties=对用户偏好数据进行分析&benefits=保障一日三餐&resume_name=数据分析师-姓名&contact=18815436610&tag=0&e_type=0&major_type=信息管理与信息系统
     */
   
    @RequestMapping(value="/insertEmploymentByEid",method=RequestMethod.POST)
    @ResponseBody
    public Object insertEmploymentByEid(HttpServletRequest request){
        return employmentService.insertEmploymentByEid(request);
    }
    
    /**
     * 功能：按照eId更新审核状态
     * 接口格式：http://localhost:8080/employment/updateEmploymentByEid?&eId=&tag=
     * 例子：http://localhost:8080/employment/updateEmploymentByEid?&eId=1&tag=1
     */
   
    @RequestMapping(value="/updateEmploymentByEid",method=RequestMethod.POST)
    @ResponseBody
    public Object updateEmploymentByEid(HttpServletRequest request){
        return employmentService.updateEmploymentByEid(request);
    }
    
    /**
     * 功能：按照eId更新salary,requirements,duties,benefits,tag
     * 接口格式：http://localhost:8080/employment/updateEmploymentAll?&eId=&salary=&requirements=&duties=&benefits=&tag=
     * 例子：http://localhost:8080/employment/updateEmploymentAll?eId=3&salary=每月一万左右&requirements=掌握多种编程语言，尤其擅长java编程&duties=底层代码编写&benefits=一日三餐，有各种运动设施&tag=1
     */
   
    @RequestMapping(value="/updateEmploymentAll",method=RequestMethod.POST)
    @ResponseBody
    public Object updateEmploymentAll(HttpServletRequest request){
        return employmentService.updateEmploymentAll(request);
    }

    
    
    
		
}